<template>
<div>
  <t-table
    rowKey="id"
    :data="data"
    :columns="columns"
    hover
    :pagination="pagination"
    :loading="dataLoading"
  >
    <template #sort="{ rowIndex }">
      {{rowIndex+1}}
    </template>

    <template #[`reviewTeam.reviewType`]="{ row }">
      {{ row?.reviewTeam?.reviewType | filterByDict(dict.type.kjsf_review_type) }}
    </template>
    <template #[`reviewTeam.name`]="{ row }">
      <t-link @click="dialog.objId=row.reviewTeam.id;dialog.header='评审组详情';dialog.open_review_group=true" hover="color" theme="primary">{{ row?.reviewTeam?.name }}</t-link>
    </template>
    <template #reviewCount="{ row }">
      <t-link @click="toPath(row)" hover="color" theme="primary">{{ row.reviewCount }}</t-link>
    </template>
    <template #op="{ row }">
      <t-button @click="toPath(row)" size="small" variant="text" class="t-button-link">
        <t-icon name="edit-1" slot="icon" />
        评审
      </t-button>
    </template>
  </t-table>
  <review-group-all-detail :header="dialog.header" :objId="dialog.objId" :visible.sync="dialog.open_review_group" v-if="dialog.open_review_group"></review-group-all-detail>
</div>
</template>

<script>
import ReviewGroupAllDetail from "../../../kjsf/review/components/review-group-all-detail.vue";

export default {
  name: "kjxm-review-group-opinion-list",
  dicts: ['kjsf_review_type'],
  components:{
    ReviewGroupAllDetail
  },
  data(){
    return {
      dialog:{
        header: '',
        objId: null,
        open: false,
        open_review_group: false,
      },
      data: [],
      columns: [
        { colKey: 'sort', title: '序号', align: 'center', width: 64 },
        { colKey: 'reviewTeam.name', title: '评审组信息', align: 'center' },
        { colKey: 'reviewTeam.reviewType', title: '评审类型', align: 'center' },
        {colKey: 'reviewCount', title: '已评/未评',align: "center"},

        { colKey: 'reviewTeam.startReviewDate', title: '评审开始时间', align: 'center' },
        { colKey: 'reviewTeam.endReviewDate', title: '评审截止时间', align: 'center' },
        { colKey: 'op', title: '操作', align: 'center' },
      ],
      dataLoading: false,
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        name: '',
        systemState: '',
      },
      pagination: {
        current: 1,
        pageSize: 10,
        total: 0,
        showPageSize: true,
        pageSizeOptions: [10,20,30],
        showFirstAndLastPageBtn: false,
        onChange: (pageInfo) => {
          Object.assign(this.pagination,pageInfo)
          this.queryParams.pageNum = pageInfo.current || 1;
          this.queryParams.pageSize = pageInfo.pageSize;
          this.getList()
        },
      },
    }
  },
  created() {
    this.getList();
  },
  methods:{
    getList(){
      this.dataLoading = true;
      this.$api.kjsf.review.teamLeaderAllReviewList(this.queryParams).then(response => {
        this.pagination.total = response.total;
        this.data = response.rows;
        this.dataLoading = false;
      }).catch((e) => {
        this.dataLoading = false;
        this.$message.error(e.toString());
      });
    },
    toPath(row){
      this.$router.push({path:`/zjk/other/kjsfReview/group/${row.reviewTeam.id}`,query:{title:`${row.reviewTeam.name}-评审组信息`}});
    },
  }
}
</script>

<style scoped>

</style>
